package db

import (
	"github.com/lib/pq"
)

// ExtractPgCode 提取pg错误码
func ExtractPgCode(errPtr *error) (pgCode string) {
	if pgerr, ok := (*errPtr).(*pq.Error); ok {
		pgCode = string(pgerr.Code)
	}
	return
}
